/**
 * Created by huguowei on 2017/5/6.
 */
function formatVideoDuration (duration, idx = 0) {
  const units = ['s', 'm', 'h']
  if (duration < 60 || idx === units.length - 1) {
    return duration.toFixed(1) + units[idx]
  }
  const index = idx + 1
  return formatVideoDuration(duration / 60, index)
}

export default formatVideoDuration
